<?
/*
 * Copyright 2004-2005 Sigve Indregard.
 *
 * This file is part of Laivsys.
 *
 * Laivsys is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Laivsys is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Laivsys; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/*
 * $Id: pamelding.php 6 2005-07-11 23:14:47Z say $
 */
 
include_once("db.php");
include_once("laivid.php");
include_once("design.php");
$arr=getLaiv();

$sidetittel=$arr['Tittel']." - P�melding";
include "top.php";

$sql="SELECT * FROM Egenskaper ORDER BY Egenskap";
$egenskaper=mysql_query($sql);

$sql="SELECT * FROM Karakteristikker ORDER BY Karakteristikk";
$karakteristikker=mysql_query($sql);

headline("S�knad om deltakelse");

if ($arr['pam_Sluttet']) {
	text("<p>P�meldingen til ".$arr['Tittel']." er dessverre stengt.</p>");
} elseif (!$arr['pam_Startet']) {
	text("<p>P�meldingen til ".$arr['Tittel']." har ikke �pnet.</p>");
} else {
	$karakter="";
	$egen="";

	//karakteristikk-checkboxes
	while ($karakteristikk = mysql_fetch_assoc($karakteristikker)) {
		$karakter.="<input type=\"checkbox\" name=\"Karakteristikk[]\" value=\"{$karakteristikk["ID"]}\"> ";
		$karakter.="{$karakteristikk["Karakteristikk"]}<br/>\n";
	}

	//egenskap-checkboxes
	while ($egenskap = mysql_fetch_assoc($egenskaper)) {
		$egen.="<input type=\"checkbox\" name=\"Egenskap[]\" value=\"{$egenskap["ID"]}\"> ";
		$egen.="{$egenskap["Egenskap"]}<br/>\n";
	}
	
	$tabell=<<<EOT

	<p>P�melding til denne laiven er uavhengig av p�melding til
	andre URV-laiver.</p>
	<form method="post" action="pamelding_postto.php">
	<table width="100%" border=0 cellspacing=2 cellpadding=0>
		<tr>
			<th colspan="2">Personalia</th>
		</tr>
		<tr>
			<td>Navn:</td>
			<td><input name="navn" size="30"></td>
		</tr>
		<tr>
			<td>Brukernavn: (minst 3 bokstaver)</td>
			<td><input name="brukernavn" size="10"></td>
		</tr>
		<tr>
			<td>Passord: (minst 5 bokstaver)</td>
			<td><input name="passord" type="password" size="10"></td>
		</tr>
		<tr>
			<td>Passord (gjenta):</td>
			<td><input name="passord2" type="password" size="10"></td>
		</tr>
		<tr>
			<td>F�dselsdato:</td>
			<td><input name="dag" size="3" value="1"> <input name="maned" size="3" value="1"> <input name="ar" size="5" value="1900"></td>
		</tr>	
		<tr>
			<td>Adresse:</td>
			<td><input name="adresse" size="30"></td>
		</tr>
		<tr>
			<td>Postnr og sted:</td>
			<td><input name="postnrsted" size="30"></td>
		</tr>	
		<tr>
			<td>E-post:</td>
			<td><input name="epost" size="30"></td>
		</tr>
		<tr>
			<td></td>
			<td>Viktig! Du m� ha en gyldig e-mail</td>
		</tr>
		<tr>
			<td>Telefon:</td>
			<td><input name="telefon" size="10"></td>
		</tr>
		<tr>
			<td>Navn p� n�rmeste p�r�rende</td>
			<td><input name="paror_navn" size="30"></td>
		</tr>
		<tr>
			<td>Telefonnummer til n�rmeste p�r�rende</td>
			<td><input name="paror_tlf" size="10"></td>
		</tr>
			<tr>
			<td>Erfaring med rollespill</td>
			<td><textarea name="erfaring" cols="30" rows="7"></textarea></td>
		</tr>
		<tr>
			<th colspan="2">Liker � spille</th>
		</tr>
		<tr>
			<td></td>
			<td>
			$karakter
			</td>
		</tr>
		<tr>
			<th colspan="2">Egenskaper:</th>
		</tr>
		<tr>
			<td></td>	
			<td>
			$egen
			</td>
		</tr>
		<tr>
			<td></td>
			<td><input type="submit" value="Meld meg p�!"></td>
		</tr>	
		</form>
	</table>
EOT;

	text($tabell, false);
}

include("bottom.php");
?>
